package com.jy.api.vo.pos.order;

import com.jy.api.domain.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import java.util.*;

/**
 * Created by lihu on 2017/10/17.
 */
@Data
public class OrderVo {

    private String id;
    private String storeName;
    private String storeAddress;
    private String storeId;
    private String memberId;
    private String memberName;
    private String memberMobile;
    private String creatorId;
    private String creatorName;
    private String code;
    private double total = 0;
    private int count = 0;
    private double discount = 0;
    private double amount = 0;
    private Date paymentTime;
    private OrderStatus status;
    private OrderSource source;
    private OrderType type;
    private Date createTime;
    private List<OrderItemDto> items = new ArrayList<>();

    private double removeZero;

    private Date refundTime;
    /**
     * 座位号
     */
    private String tableNo;
    private Date addTime;
    private Date updateTime;
    private boolean enabled = true;
    /**
     * 固定提成金额
     */
    private double commission = 0;

    /**
     * 支付ID
     */
    private String payId;

    private String deliveryName;

    /**
     * 商品出入库状态
     */
    private boolean stock = false;

    /**
     * 备注
     */
    private String notes;

    /**
     * 退单原因
     */
    private String refundReason;


    private List<Payment> payments = new ArrayList<>();

    /**
     * 优惠卷使用信息
     */
    private List<CouponInstance> couponInstances = new ArrayList<>();

    private String productLeftCount;

    private List<DiscountOrderItem> discountOrderItem=new ArrayList<>();

    @Data
    public static class Payment {
        private String id;
        private String orderId;
        private Date createTime;
        private String storeId;
        private Double amount;
        private boolean success = false;
        private String channel;
        private PaymentStatus status;
    }


    @Data
    public static class CouponInstance {


        /**
         * 优惠券名称
         */
        private String couponName;

        /**
         * 抵用商品id
         */
        private String productId;
        /**
         * 抵用商品名称
         */
        private String productName;
        /**
         * 优惠券实例编码
         */
        private String couponInstanceCode;
        /**
         * 抵用商品销售价格
         */
        private int productSalePrice;
        /**
         * 抵用商品数量
         */
        private short productQuantity;


    }

    @Data
    public static class OrderItemDto {
        private String id;

        private String productName;
        private String productId;
        private String productImageURL;
        private String productTypeId;
        private double salesPrice = 0;
        private String deliveryName;
        private double dealPrice = 0;

        private double costPrice = 0;
        private int quantity = 0;

        private Date addTime;

        private Date updateTime;

        private boolean enabled = true;

        private List<OrderItemExtra> items = new ArrayList<>();

        private String mobileTag;
        /**
         * 固定提成金额
         */
        private double commission = 0;
        /**
         * 是否支持厨房打印
         */
        private boolean kitchenPrintEnabled = false;

        /**
         * 是否支持热敏打印
         */
        private boolean isDirectTherma = false;

        private boolean labelEnabled=false;


        private int ipId;

        private String ipName="";

        private int port=0;

        private Set<ProductSpec> productSpecs=new HashSet<>();

        private String ipAddress="";
        @ApiModelProperty("是否配品订单详情")
        private boolean matchEnabled;

        @ApiModelProperty("是否含有配品商品")
        private boolean haveMatchEnabled;
        @ApiModelProperty("主订单记录id")
        private String masterItemId;

        private List<String> specs;

        //是否开启配品点单
        private  boolean openMatchEnabled;

        private List<MasterItemDto> masterItemDtos = new ArrayList<>();

        private List<String> makeIds=new ArrayList<>();


        private List<String> codes=new ArrayList<>();

        private List<String> tips=new ArrayList<>();


        @Data
        public static class MasterItemDto {
            private String id;

            private String productName;
            private String productId;
            private String productImageURL;
            private String productTypeId;
            private double salesPrice = 0;

            private double dealPrice = 0;

            private double costPrice = 0;
            private int quantity = 0;

            private Date addTime;

            private Date updateTime;

            private boolean enabled = true;

            private List<OrderItemExtra> items = new ArrayList<>();

            private String mobileTag;
            /**
             * 固定提成金额
             */
            private double commission = 0;
            /**
             * 是否支持厨房打印
             */
            private boolean kitchenPrintEnabled = false;

            /**
             * 是否支持热敏打印
             */
            private boolean isDirectTherma = false;

            private boolean labelEnabled=false;


            private int ipId;

            private String ipName="";

            private int port=0;

            private String ipAddress="";
            @ApiModelProperty("是否配品订单详情")
            private boolean matchEnabled;

            @ApiModelProperty("是否含有配品商品")
            private boolean haveMatchEnabled;
            @ApiModelProperty("主订单记录id")
            private String masterItemId;
            private List<String> specs;



        }
    }




}
